<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<%
String sortType=request.getParameter("conds.sortType");
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache" />
<title>欢迎访问产品运营互动中心！</title>
<link rel="stylesheet" href="<s:url value="/css/style.css"/>">
<style type="text/css">
	.mylink {
		FONT-SIZE: 9pt; COLOR: #0000FF; TEXT-DECORATION: none
    }
</style>
<script type="text/javascript" src="<s:url value="/script/sysOper.js"/>"></script>
<script type="text/javascript" src="<s:url value="/xtreecheckbox/js/xtree.js"/>"></script>
<link type="text/css" rel="stylesheet" href="<s:url value="/xtreecheckbox/xtree.css"/>" />
<script type="text/javascript" src="<s:url value="/script/easyajax.js"/>"></script>
<script>
var sortType="<%=sortType%>";
var url="/poc/business/catalog/viewNextProductSort.action?conds.sortType="+sortType+"&conds.parentSort=";
var oldUrl="/poc/business/catalog/viewNextProductSort.action?conds.sortType="+sortType+"&conds.parentSort=";
var prodcutUrl="/poc/business/product/viewNextproductRefSort.action?conds.sort=";
function getNextView(url,obj){
    var path="/poc/images/arrow2.gif";
    var eventTr="";
	callSynchronized(url,function(XML){//同步调用
	    var ajax=new AjaxObj();
	    ajax.xml=XML.responseXML;
	    alert(XML.responseXML.xml);
	    eventTr=obj.parentElement.parentElement;
	    //alert("id="+eventTr.id+" jb="+eventTr.jb+"  parentSort="+eventTr.parentSort+"   display"+eventTr.style.display);
	    var ind= eventTr.rowIndex+1;
	    for(i=0;i<ajax.length();i++){
	    	var tr=sortTable.insertRow(ind+i);
	    	var currentJb=parseInt(eventTr.jb)+1;
	    	tr.bgColor="F5FAFF";
	    	tr.setAttribute("jb",currentJb);
	    	tr.setAttribute("parentSort",eventTr.id);
	    	var td0=document.createElement("td");
	    	tr.appendChild(td0);
	    	var td=document.createElement("td");
    	    tr.setAttribute("id",eventTr.id+$$(ajax.datas(i),"id")+";");
    	   // tr.bgColor="F5FAFF";
	    	if($$(ajax.datas(i),"childCount")>0){
	    		td.innerHTML="<img onclick=getNextView2(url+'"+$$(ajax.datas(i),"id")+"',this) src=<s:url value='/images/arrow1.gif'/> height='12'>&nbsp;"+$$(ajax.datas(i),"name");
	    	}else{
	    		td.innerHTML="&nbsp;"+$$(ajax.datas(i),"name");
	    	}
	    	tr.appendChild(td);
	    	var td3=document.createElement("td");
	    	tr.appendChild(td3);
	    }
	});
	//if(type) return;
	path="/poc/images/arrow1_1.gif";
	obj.outerHTML="<img id='img"+eventTr.id+"'  onclick='showAndHidden(this)' src='"+path+"' height='12'>"+"&nbsp;";
	
}
function getNextView2(url,obj){
    var path="/poc/images/arrow2.gif";
    var eventTr="";
	callSynchronized(url,function(XML){//同步调用
	    var ajax=new AjaxObj();
	    ajax.xml=XML.responseXML;
	    eventTr=obj.parentElement.parentElement;
	    //alert("id="+eventTr.id+" jb="+eventTr.jb+"  parentSort="+eventTr.parentSort+"   display"+eventTr.style.display);
	    var ind= eventTr.rowIndex+1;
	    for(i=0;i<ajax.length();i++){
	    	var tr=sortTable.insertRow(ind+i);
	    	var currentJb=parseInt(eventTr.jb)+1;
	    	tr.setAttribute("jb",currentJb);
	    	tr.setAttribute("parentSort",eventTr.id);
	    	var td0=document.createElement("td");
	    	tr.appendChild(td0);
	    	var td=document.createElement("td");
    	    tr.setAttribute("id",eventTr.id+$$(ajax.datas(i),"id")+";");
    	   // tr.bgColor="F5FAFF";
	    	if($$(ajax.datas(i),"childCount")>0){
	    		td.innerHTML="&nbsp;"+$$(ajax.datas(i),"name");
	    	}else{
	    		td.innerHTML="&nbsp;"+$$(ajax.datas(i),"name");
	    	}
	    	
	    	var td3=document.createElement("td");
	    	tr.appendChild(td3);
	    	tr.appendChild(td);
	    }
	});
	//if(type) return;
	path="/poc/images/arrow1_1.gif";
	obj.outerHTML="<img id='img"+eventTr.id+"'  onclick='showAndHidden(this)' src='"+path+"' height='12'>"+"&nbsp;";
	
}
function showAndHidden(obj){
     var eventId=obj.parentElement.parentElement.id;
     for(i=1;i<sortTable.rows.length;i++){
	 	var parentSort=sortTable.rows[i].parentSort;
	 	if(parentSort==eventId){
	 		if(sortTable.rows[i].style.display==""){
	 			sortTable.rows[i].style.display="none";
	 		}else{
	 		    if(sortTable.rows[i].parentSort==eventId){
	 				sortTable.rows[i].style.display="";
	 			}
	 		}
	 	}
	 }
	 if(obj.src.indexOf("arrow1_1.gif")!=-1){
	 	obj.src="/poc/images/arrow1.gif";
	 }else{
	    obj.src="/poc/images/arrow1_1.gif";
	 }
}
function getSpace(jb){
	var str="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	var returnStr="";
	while(jb>0){
		returnStr+=str;
		jb--;
	}
	return returnStr;
}
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
<table width="998" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td  background="<s:url value="/images/home_4a.gif"/>"> 
      <table width="863" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
        <tr>
          <td width="197" valign="top">
		   <%@ include file="/commons/include/catalog_left.inc"%>  
   		  </td>
          <td valign="top" height="100%">
            
            <s:form id="form1" action="/business/catalog/productSort/listProductSort.action"
					method="post">
					<table width="660" border="0" cellspacing="0" cellpadding="0"
						background="<s:url value="/images/catalog_manage_8b.gif"/>">
						<tr>
							<td><img src="<s:url value="/images/catalog_manage_8.gif"/>" width=660
								height=11 alt=""></td>
						</tr>
						<tr>
							<td>
							<table id="sortTable" width="98%" border="0" cellspacing="0" cellpadding="7"
								align="center" class=tablecolor2>
								<tr>
									<td bgcolor="9AC2EB" width="13%">
									<div><font color="#FFFFFF">一级目录 </font></div>
									</td>
									<td bgcolor="9AC2EB" width="13%">
									<div><font color="#FFFFFF">二级目录 </font></div>
									</td>
									<td bgcolor="9AC2EB" width="13%">
									<div><font color="#FFFFFF">三级目录 </font></div>
									</td>
								</tr>
							<s:iterator value="productSorts">
								<tr id=";<s:property value="id" />;" jb="0" parentSort="0" bgcolor="D4E7FA">
									<td >
										<img onclick="getNextView(url+'<s:property value="id" />',this)" src="<s:url value="/images/arrow1.gif"/>" height="12">&nbsp;&nbsp;<s:property value="name" />
									</td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
								</tr>
							</s:iterator>
							</table>
							</td>
						</tr>
						<tr>
							<td>
								<img src="<s:url value="/images/catalog_manage_8a.gif"/>" width="660"
								height="9">
							</td>
						</tr>
					</table>
				</s:form> 
</body>
</html>
<script>

</script>